package cn.org.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.org.IDao.PersonMapper;
import cn.org.IDao.PersonOrgPosMapper;
import cn.org.domain.Org;
import cn.org.domain.Person;
import cn.org.domain.PersonOrgPos;
import cn.org.domain.Position;
import cn.org.service.IPersonService;

@Service("personService")
public class PersonServiceImpl implements IPersonService {
	@Resource
	private PersonMapper personDao;
	
	@Resource
	private PersonOrgPosMapper personorgposDao;

	@Override
	public int deleteByPrimaryKey(Integer id) {
		
		return personDao.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(Person record) {
		
		return personDao.insert(record);
	}

	@Override
	public int insertSelective(Person record) {
		return personDao.insertSelective(record);
	}

	@Override
	public Person selectByPrimaryKey(Integer id) {
		
		return personDao.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKeySelective(Person record) {
		
		return personDao.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(Person record) {
		return personDao.updateByPrimaryKey(record);
	}

	@Override
	public List<Person> getALLPerson() {
		return personDao.getALLPerson();
	}

	@Override
	public List<Person> getPersonsByOrg(Org org) {
		
		return personDao.getPersonsByOrg(org.getId());
	}

	@Override
	public List<Person> getPersonsByPos(Position pos) {
		return personDao.getPersonsByPos(pos.getId());
	}

	@Override
	public Person getPersonByName(String name) {
		return personDao.getPersonByName(name);
	}

	@Override
	public int insertPersonOrgPos(PersonOrgPos pop) {
		return personorgposDao.insert(pop);
	}

	@Override
	public PersonOrgPos selectByPOP(int org_id, int person_id, int pos_id) {
		return personorgposDao.selectByPOP(org_id, person_id, pos_id);
	}

	@Override
	public int updateByPrimaryKey(PersonOrgPos record) {
		return personorgposDao.updateByPrimaryKey(record);
	}

	@Override
	public int deletePop(Integer id) {
		return personorgposDao.deleteByPrimaryKey(id);
	}

	@Override
	public List<PersonOrgPos> selectByPerson(Person p) {
		return personorgposDao.selectByPerson(p.getId());
	}

	
	

}
